class Page6 extends egret.Sprite{
	private building:egret.Bitmap;
	private blink:egret.Bitmap;
	private arr_pic;

	private bg1:egret.Bitmap;
	private bg2:egret.Bitmap;
	private bg3:egret.Bitmap;
	private bg4:egret.Bitmap;
	public constructor() {
		super();
		this.initial();
	}
	public initial(){
		this.bg1=new egret.Bitmap(RES.getRes("bg6_png"));
		this.addChild(this.bg1);
		this.bg2=new egret.Bitmap(RES.getRes("bg66_png"));
		this.addChild(this.bg2);
		this.bg3=new egret.Bitmap(RES.getRes("bg666_png"));
		this.addChild(this.bg3);
		this.bg4=new egret.Bitmap(RES.getRes("bg6666_png"));
		this.addChild(this.bg4);

		this.bg2.y=61;
		this.bg3.x=184;
		this.bg4.x=31;this.bg4.y=389;

		this.arr_pic=new Array();
		for(var z=1;z<=4;z++){
			var pic=new egret.Bitmap(RES.getRes("page6pic"+z+"_png"));
			this.addChild(pic);
			switch(z){
				case 1:pic.x=285;pic.y=669;break;
				case 2:pic.x=108;pic.y=731;break;
				case 3:pic.x=223;pic.y=805;break;
				case 4:pic.x=265;pic.y=878;break;

			}
			this.arr_pic.push(pic);
		}
		this.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.TB,this);

	}
	private TB(e:TouchEvent){
		this.touchEnabled=false;
		GoEvent.msg.dispatchEvent(new GoEvent("ChangePage","7"));
	}
	public End(){
		egret.Tween.get(this).to({alpha:0},600,egret.Ease.cubicOut);
	}

	public Show(){
			var This=this;
		setTimeout(function(){
			This.touchEnabled=true;
		},3000)


		var This=this;
		this.alpha=0;
		egret.Tween.get(this).to({alpha:1},700,egret.Ease.cubicOut);


		
		this.bg2.x=169;
		this.bg3.y=380;

		this.bg2.alpha=0;
		this.bg3.alpha=0;
		this.bg4.alpha=0;
		egret.Tween.get(this.bg2).to({alpha:1,x:129},800,egret.Ease.cubicOut);
		egret.Tween.get(this.bg3).wait(300).to({alpha:1,y:410},900,egret.Ease.cubicOut);
		egret.Tween.get(this.bg4).wait(500).to({alpha:0.5},500,egret.Ease.cubicOut);
		setTimeout(function(){
			egret.Tween.get(This.bg4,{loop:true}).to({alpha:1},1000,egret.Ease.cubicOut).to({alpha:0.5},1000,egret.Ease.cubicOut);
		},1000)

		for(var z=0;z<this.arr_pic.length;z++){
			this.arr_pic[z].alpha=0;
			this.arr_pic[z].y+=50;
			egret.Tween.get(this.arr_pic[z]).wait(1200+z*400).to({alpha:1,y:this.arr_pic[z].y-50},800,egret.Ease.cubicOut);
		}
	}
}